# 打开摄像头
import cv2

if __name__ == '__main__':
    cap = cv2.VideoCapture(0)
    while True:
        fig,frame = cap.read()
        # 判断摄像头未启动
        if fig is None:
            print("Capture No Found")
            break
        # 手动退出
        if cv2.waitKey(1) == ord(" "):
            break
        cv2.imshow("capture",frame)
    # 释放资源
    cap.release()
    cv2.destroyAllWindows()